package com.common.hbase.domain;

import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;

public class PutDomain {

    /*
    *  表名
    * */
    private String tableName;

    /*
    *  键值
    * */
    private String rowKey;

    /*
    *  列族
    * */
    private String columnFamily;

    /*
    *  字段
    * */
    private String field;

    /*
    *  值
    * */
    private String value;

    public PutDomain() {
    }

    public PutDomain(String tableName, String rowKey, String columnFamily, String field, String value) {
        this.tableName = tableName;
        this.rowKey = rowKey;
        this.columnFamily = columnFamily;
        this.field = field;
        this.value = value;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getRowKey() {
        return rowKey;
    }

    public void setRowKey(String rowKey) {
        this.rowKey = rowKey;
    }

    public String getColumnFamily() {
        return columnFamily;
    }

    public void setColumnFamily(String columnFamily) {
        this.columnFamily = columnFamily;
    }

    public String getField() {
        return field;
    }

    public void setField(String field) {
        this.field = field;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Put getPut(){
        Put put = new Put(Bytes.toBytes(this.rowKey));
        put.addColumn(Bytes.toBytes(this.columnFamily), Bytes.toBytes(this.field), Bytes.toBytes(this.value));
        return put;
    }
}
